package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092600597724";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDj+qbOMcSYH5Jbs+3u6bTPKDzWSeXRNJQTCa6jWmFKvLeBtjReNOx2uDvb9Sd/Baoq9FPxCex6SnpwZs5wOfXoC3KUnfGs+m9jIPw8ho6aUwbJK2/fDm8MCSVNarZinWvJvC3WkqWEMIObCvWt0di0eTFLIRRo4Cdbz3petBZmQRPXxhmdVuz3uonLN/qBtogI1/rAkCs64MuuIc5XydL1JFHR+CM2iXdKUK4TTf9gVzI2exyvFw/27OfMMT1QRjip8kKcczULaZUGigGkX+MPWnIYihEp7X+ujIebBcIoi75lSfiaUMLrp+IlhS3HUmqmzmWtY3wcwC02t0j0Un4LAgMBAAECggEABfAiZh5/u2KfIkpWeTGXJwoqQ36bQM64yKIo7VJOVG8D7Jn9VTLVseXskTcad0GDhCjnAtE6WpkUBVd4Kw4nbIrXyi0u/U1sl01lpIHwtu5Qr+60tD+g/tRCJ3kPFRR6mT+QhhU9wGqvEtu/OG7N0S2S7h0Hdg/YlpiZ3Fuedb1RmYpZJG+R6/+qgpuNoN5cBi97ddMUz1ryokl4gOpNIJXV8Msvs6O24aPRFm13iUYYxqT9VUjKkQw67NXTytLBZPAiyPXH0G/oeg8DLvZNDcbemyfHstl7mZhgf66uhKsbs6NOETDTrqkK/1VnLYovjdkMWa7b3Bh7uOZUn1oE6QKBgQD7scBKeXYaPBpOmlpmxHOTkqVXNu8V+Kt3Lz8E2Y3CoAY0pDroLJEJt9RUQe1ksgVtNOOj319u8LW4wwwAcCEyRb/OQd550IDuJQ+GyJaWxzcU+ydEaP2WjA3cvoT+FC9AiR7pevdtl5i3oHAN8E/iubkhgaEfK3DoVwsyNAhhxQKBgQDn4QtBc0GAKeqKVZlOFvIjBVgI3y5pBtszBFgYeEPbHCJiXukZBY8SCXUxcGnCAxufZwHN9CQ66xnxibUdlYbsV6uFvG1SqvqC5I3wluCKggnPsEygRJWPlyzrVwCCyi6Li6IHsxYD+J5KG3Ft+7K7gtBAAxX3HoyiZeNZiSdtjwKBgQCdzU7zIn3iauZPe8TMA8U2s82IBcAWdWcDfZK0NrYDXRMm9ASexjpU7nVoMkFlTZvLYUqL1qNdyfsVEOy4ZZTakRJ1faS/mPMM3B2E8sQ/Wj11oRV4dZ7wQXT7flOhfQQ3IQFJfzgb9Nzh2+wFQTLEwo6IrF5ZTYInmVNCsY7DxQKBgQCIxwSerN/cO91vkCKIH5zg74wIX62+oh62rz9P39EW9DeMEzQoYFEOcKnCae7YVID8vAQienrMjlWVVoeRVdxqmSRCFO3fr59pimv3mOgGi8JB0lrAxvP56VDD2WQhwiVGhy0ioY7A9OxaBmoYWDoLxZQVzjwsssZ+HN/IttCdHQKBgBFDjApguvBHUE/px9/zcGcgz/D1ic2lZTqRfRKC0ETqt0BKQg3rN+K/vOJMi4WnZEbb3Qpa+I4q1nbX4KamgxWfixw6eDJb2IwKJDWhgdxm7ZYO6yhKno0+68nJn/jxn+Sh+klWZ5U1/cfTUPSa7m62ELOnmRge6NuFezyW+K6R";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3rzi9NAxs7oyedZU4V1Z7N3jeeBniLKHy/gEIH93pnxrNe86O7FSXrCCqYi5XDNP+jg/PDrj10kzP81SYyXXe7W0v606iAlgNImC+iePu0Dg7gthINQvpMDpT6dmPqpgoiy7DvPBz9bbU147tUp0sRmVNrBcil49C1FhgHLDxrUsJtIF+cMhEHn6rEinebk/Dr/80dEsWVtBjuRU17GRhpE3Wm+F1uGsMj71pRWrY9boM9H2zO2QFCo27XXMThl1Idc2K6FKoxKOCliqUyCRZiBgJBoW078G4+6hBGCIKH9uD7RLDmSVlEDIKn8q/MggcI+wQpKEnAMF5b1Hzp+h/wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://2t4539u789.qicp.vip:20733/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://2t4539u789.qicp.vip:20733/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

